package com.force.langchain4j.models;

import com.force.langchain4j.config.CommonConstants;
import dev.langchain4j.data.message.AiMessage;
import dev.langchain4j.data.message.UserMessage;
import dev.langchain4j.model.chat.ChatLanguageModel;
import dev.langchain4j.model.openai.OpenAiChatModel;
import dev.langchain4j.data.message.SystemMessage;
public class DeepSeekModel {

    public static void main(String[] args) {
        // 创建智谱的模型对象
        ChatLanguageModel model = OpenAiChatModel.builder()
                // deepseek的api的访问路径
                .baseUrl("https://api.deepseek.com")
                .apiKey(CommonConstants.DP_API_KEY)
                // 模型名称
                .modelName("deepseek-chat")
                .build();

        // 系统消息
        SystemMessage systemMessage = SystemMessage.from("你是一个经验丰富的医生");
        UserMessage firstUserMessage = UserMessage.from("如果肚子疼，需要去医院看哪个科室");
        // ai返回的消息
        AiMessage firstAiMessage = model.chat(systemMessage, firstUserMessage).aiMessage();
        System.out.println(firstAiMessage.text());
    }
}
